// index.js

Page({
  onShareAppMessage() {
    return {
      title: 'swiper',
      path: 'page/component/pages/swiper/swiper'
    }
  },

  data: {
    imgUrls: [
      // ' ../image/swiper/01.jpg',
      // ' ../image/swiper/02.jpg',
      // ' ../image/swiper/03.jpg'
    ],
    indicatorDots: true, //	是否显示面板指示点
    autoplay: true, //是否自动切换
    circular: true, //是否采用衔接滑动
    vertical: false, //滑动方向是否为纵向
    interval: 3000, //自动切换时间间隔
    duration: 1000, //滑动动画时长
    goodsListData: [{
      id: 1,
      imgUrls: ["https://tse1-mm.cn.bing.net/th/id/R-C.541d315de4b11e79e0bcb84f35ccf30b?rik=V96LdUGfUZJu5g&riu=http%3a%2f%2fimage.qianye88.com%2fpic%2f812f74e3a664e1c2b1e0e8cde0480e8c&ehk=o55Cw49jjhzmX%2bO%2fvYRXQsoMo3R%2f%2fuXTqpx%2bM88E63M%3d&risl=&pid=ImgRaw&r=0"],
      goodprice: 666,
      goodTitle: "安康景区-大湖-三日游",
      goodDetails: ""
    }, {
      id: 2,
      imgUrls: ["https://tr-osdcp.qunarzz.com/tr-osd-tr-manager/img/62c6fba19f122c4aaabbac763d0c84c1.jpg"],
      goodprice: 888,
      goodTitle: "安康景区-夜灯-七日游",
      goodDetails: ""
    }, {
      id: 3,
      imgUrls: ["https://tse1-mm.cn.bing.net/th/id/R-C.b71f0b7e18392012b3bf1a83e6369b8b?rik=CI4CHHGBBYaZIw&riu=http%3a%2f%2fimage.qianye88.com%2fpic%2f478bc3c8432f57cb3c41b0c7207db9a2&ehk=rdTpcs3e%2bWalRh2gXUCdEm5C4ihS67Y0osHxvEvGJ3g%3d&risl=&pid=ImgRaw&r=0"],
      goodprice: 999,
      goodTitle: "安康景区-红桥-七日游",
      goodDetails: ""
    },
    {
      id: 4,
      imgUrls: ["https://tse1-mm.cn.bing.net/th/id/R-C.b71f0b7e18392012b3bf1a83e6369b8b?rik=CI4CHHGBBYaZIw&riu=http%3a%2f%2fimage.qianye88.com%2fpic%2f478bc3c8432f57cb3c41b0c7207db9a2&ehk=rdTpcs3e%2bWalRh2gXUCdEm5C4ihS67Y0osHxvEvGJ3g%3d&risl=&pid=ImgRaw&r=0"],
      goodprice: 555,
      goodTitle: "安康景区-红桥-三日游",
      goodDetails: ""
    }
  ] //商品详情

  },
  onLoad: function() {
    wx.request({
      url: 'http://localhost:5000/imgUrls',
      success: res =>{
        this.setData({
          imgUrls: res.data
        })
      }
    })
  },
  // 跳转详情页
  navgoodsDetails(e) {
    // console.log(e.currentTarget.dataset.name.id)
    // 传入商品id
    wx.navigateTo({
      url: '../goodsDetails/goodsDetails?goodsId=' + e.currentTarget.dataset.name.id,
    })
  },
  // 景点
  goViews(){
    wx.navigateTo({
      url: '../../pages/views/views',
    })
  },
  // 酒店
  goHotel(){
    wx.navigateTo({
      url: '../../pages/hotel/hotel',
    })
  },
  // 特产美食
  goFood(){
    wx.navigateTo({
      url: '../../pages/food/food',
    })
  },
  // 包车
  goCar(){
    wx.navigateTo({
      url: '../../pages/car/car',
    })
  },
  // 精品线
  goRoute(){
    wx.navigateTo({
      url: '../../pages/routine/routine',
    })
  },
  // 轮播
  changeIndicatorDots() {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },

  changeAutoplay() {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },

  intervalChange(e) {
    this.setData({
      interval: e.detail.value
    })
  },

  durationChange(e) {
    this.setData({
      duration: e.detail.value
    })
  }
})